/*
 * Copyright (c) 2021, mrwang. All rights reserved.
 */

package com.wuyan.authorization.security;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.security.provisioning.JdbcUserDetailsManager;
import org.springframework.security.web.server.SecurityWebFilterChain;

import javax.sql.DataSource;

/**
 * @author dong
 * @version V1.0
 * @file com.wuyan.gateway.core.security.WebSecurityConfig
 * @description
 * @date 2021-03-08
 * @update [序号][日期YYYY-MM-DD] [更改人姓名][变更描述]
 */
@EnableWebFluxSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
	@Autowired
	DataSource dataSource;

	@Bean
	@Override
	public UserDetailsService userDetailsService() {
		return new JdbcUserDetailsManager(this.dataSource);
	}

}